package com.asset.dispoal.business.bsAssetInstitutionBatch.service;

import com.asset.dispoal.business.bsAssetInstitutionBatch.api.IBsAssetInstitutionBatchService;
import com.asset.dispoal.business.bsAssetInstitutionBatch.dto.BsAssetInstitutionBatchRequest;
import com.asset.dispoal.business.bsAssetInstitutionBatch.dto.BsAssetInstitutionBatchResponse;
import com.asset.dispoal.business.bsAssetInstitutionBatch.dto.BsAssetInstitutionPolicyRequest;
import com.asset.dispoal.business.bsAssetInstitutionBatch.dto.BsAssetInstitutionPolicyResponse;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.BsAssetInstitutionBatchInsert;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.BsAssetInstitutionBatchQueryPage;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.BsAssetInstitutionBatchQueryTree;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.BsAssetInstitutionBatchUpdate;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.PolicyInsertCommand;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom.QueryPolicyByIdCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;


/**
 * 资产机构批次表服务实现类
 *
 * @author: mhuang
 * @date: 2022-03-10 09:40:20
 */
@Service
public class BsAssetInstitutionBatchServiceImpl implements IBsAssetInstitutionBatchService {

    @Autowired
    BsAssetInstitutionBatchUpdate bsAssetInstitutionBatchUpdate;

    @Autowired
    BsAssetInstitutionBatchQueryTree bsAssetInstitutionBatchQueryTree;

    @Autowired
    BsAssetInstitutionBatchInsert bsAssetInstitutionBatchInsert;

    @Autowired
    BsAssetInstitutionBatchQueryPage bsAssetInstitutionBatchQueryPage;

    @Autowired
    QueryPolicyByIdCommand queryPolicyByIdCommand;

    @Autowired
    PolicyInsertCommand policyInsertCommand;


    @Override
    public void insert(BsAssetInstitutionBatchRequest bsAssetInstitutionBatchRequest) {
        bsAssetInstitutionBatchInsert.execute(bsAssetInstitutionBatchRequest);
    }

    @Override
    public void update(BsAssetInstitutionBatchRequest bsAssetInstitutionBatchRequest) {
        bsAssetInstitutionBatchUpdate.execute(bsAssetInstitutionBatchRequest);
    }

    @Override
    public Result<PageVO<BsAssetInstitutionBatchResponse>> queryTree(BsAssetInstitutionBatchRequest bsAssetInstitutionBatchRequest) {
        final Result<PageVO<BsAssetInstitutionBatchResponse>> execute = bsAssetInstitutionBatchQueryTree.execute(bsAssetInstitutionBatchRequest);
        return execute;
    }

    @Override
    public Result<PageVO<BsAssetInstitutionBatchResponse>> queryPage(BsAssetInstitutionBatchRequest bsAssetInstitutionBatchRequest) {

        Result<PageVO<BsAssetInstitutionBatchResponse>> execute = bsAssetInstitutionBatchQueryPage.execute(bsAssetInstitutionBatchRequest);
        return execute;
    }

    @Override
    public Result<BsAssetInstitutionPolicyResponse> getPolicyById(String id) {
        return queryPolicyByIdCommand.execute(id);
    }

    @Override
    public void createPolicy(BsAssetInstitutionPolicyRequest request) {
        policyInsertCommand.execute(request);
    }
}